package reflect;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Demo {


    private List<String> list;
    private List<String> arrayList = new ArrayList<>();
    private String[] array;
    private Date date;

    public void say(){
        System.out.println("Demo say Hello!");
    }


    public static void main(String[] args) {
        Field[] field = Demo.class.getDeclaredFields();
        for(Field f : field){
            if(f.getType().getName() == List.class.getName()){
                System.out.println(f.getName());
                System.out.println(f.getType());
                System.out.println(f.getType().isArray());
            }

            if(f.getType().getName() == Date.class.getName()){
                System.out.println(f.getName());
                System.out.println(f.getType());
            }
        }

        System.out.println("========================");
        Method[] methods = Demo.class.getMethods();
        for(Method method : methods){
            System.out.println("Method Name :" + method.getName() + "; DeclaringClass: " +method.getDeclaringClass().getName());
        }
    }
}
